﻿class BaseCell implements ICell {
    grid: IGrid;
    IterationsSinceLastCellChange: number;
    State: CellState;
    NextState: CellState;
    LastState: CellState;
    x: number;
    y: number;

    CalculateNextState() {
    }

    TakeOverNextState() {
        if (this.State == this.NextState)
            this.IterationsSinceLastCellChange++;
        else
            this.IterationsSinceLastCellChange = 0;

        this.LastState = this.State;
        this.State = this.NextState;
    }

    InitCell(grid: IGrid, state: CellState, x: number, y: number) {
        this.grid = grid;
        this.State = state;
        this.NextState = state;
        this.LastState = state;
        this.x = x;
        this.y = y;
        this.IterationsSinceLastCellChange = 0;
    }
}